<extend name="Base/common" />
<block name="body">
  <div class="span9 page_message">
    <section id="contents">
      <ul class="tab-nav nav">
        <li class=""><a href="{:U('lists')}">刮刮卡列表<b class="arrow fa fa-sort"></b></a></li>
        <li class="current"><a href="javascript:;">编辑刮刮卡<b class="arrow fa fa-sort"></b></a></li>
      </ul>
      <div class="tab-content"> 
        <!-- 表单 -->
        <php> $post_url || $post_url = U('edit?model='.$model['id'], $get_param);</php>
        <form id="form" action="{$post_url}" method="post" class="form-horizontal form-center">
        	<ul id="tab" class="tab-pane in">
            	 <li class="form-item cf">
                    <label class="item-label"><span class="need_flag">*</span>关键词<span class="check-tips"></span></label>
                    <div class="controls">
                      <input type="text" class="text input-large" name="keyword" value="{$data.keyword}">
                    </div>
                  </li> 
                  <li class="form-item cf">
                    <label class="item-label"><span class="need_flag">*</span>标题<span class="check-tips"></span></label>
                    <div class="controls">
                      <input type="text" class="text input-large" name="title" value="{$data.title}">
                    </div>
                  </li>  
                  <li class="form-item cf">
                    <label class="item-label"><span class="need_flag"></span>封面简介<span class="check-tips"></span></label>
                    <div class="controls">
                      <label class="textarea input-large">
                      <textarea class="text input-large" name="intro" >{$data.intro}</textarea>
                      </label>
                    </div>
                  </li>   
                  <li class="form-item cf">
                  		<label class="item-label"><span class="need_flag"></span>封面图片<span class="check-tips"></span></label>
                		<div class="controls uploadrow2" title="点击修改图片" rel="cover">
                            <input type="file" id="upload_picture_cover">
                            <input type="hidden" name="cover" id="cover_id_cover" value="{$data.cover}"/>
                            <div class="upload-img-box">
                              <notempty name="data[cover]">
                                <div class="upload-pre-item2"><img width="100" height="100" src="{$data.cover|get_cover_url}"/></div>
                                <em class="edit_img_icon">&nbsp;</em>
                              </notempty>
                            </div>
                      </div>
                  </li>
                  <li class="form-item cf">
                    <label class="item-label"><span class="need_flag">*</span>使用说明<span class="check-tips"></span></label>
                    <div class="controls">
                      <label class="textarea input-large">
                      <textarea class="text input-large" name="use_tips" >{$data.use_tips}</textarea>
                      </label>
                    </div>
                  </li>   
                  
                  <li class="form-item cf">
                  		<label class="item-label"><span class="need_flag">*</span>过期说明<span class="check-tips"></span></label> 
                        <div class="controls">
                  			<label class="textarea">
                            <textarea name="end_tips" style="width:405px; height:100px;">{$data.end_tips}</textarea></label>
                        </div>
                  </li>
                   <li class="form-item cf">
                    <label class="item-label"><span class="need_flag">*</span>有效期<span class="check-tips"></span></label>
                    <div class="controls">
                       <input type="datetime" name="start_time" class="text time" value="{$data.start_time|time_format}" placeholder="请选择时间" /> - 
                       <input type="datetime" name="end_time" class="text time" value="{$data.end_time|time_format}" placeholder="请选择时间" />
                    </div>
                  </li>   
                  <li class="form-item cf">
                    <label class="item-label"><span class="need_flag">*</span>预计参与人数 <span class="check-tips">（预计人数直接影响抽奖概率：中奖概率 = 奖品总数/(预估活动人数*每人抽奖次数) 要确保100%中奖可设置为1）</span></label>
                    <div class="controls">
                      <input type="number" class="text input-large" name="predict_num" value="{$data.predict_num}">
                    </div>
                  </li>  
                   <li class="form-item cf">
                    <label class="item-label"><span class="need_flag">*</span>每人最多允许抽奖次数<span class="check-tips">（0表示不限制）</span> </label>
                    <div class="controls">
                      <input type="number" class="text input-large" name="max_num" value="{$data.max_num}">
                    </div>
                  </li>  
                
                  
            </ul>
          	<div class="form-item form_bh">
            	<notempty name="data.id"><input type="hidden" name="id" value="{$data.id}"></notempty>
            	<button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            </div>
        </form>
      </div>
    </section>
  </div>
</block>
<block name="script">
  <link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
  <php>if(C('COLOR_STYLE')=='blue_color') echo '
    <link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    ';</php>
  <link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
  <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.js"></script> 
  <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}" charset="UTF-8"></script> 
<script type="text/javascript">
$(function(){
	 initUploadImg();
	 })
$('#submit').click(function(){
    $('#form').submit();
});

$(function(){
    $('.time').datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        language:"zh-CN",
        minView:0,
        autoclose:true
    });
    $('.date').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });	
    showTab();
	
	$('.toggle-data').each(function(){
		var data = $(this).attr('toggle-data');
		if(data=='') return true;		
		
	     if($(this).is(":selected") || $(this).is(":checked")){
			 change_event(this)
		 }
	});
	
	$('.toggle-data').bind("click",function(){ change_event(this) });
});
</script> 
</block>
